/* enum IpAddressKind {
    V4,
    V6,
}
 */
/* struct IpAddr {
    kind: IpAddressKind,
    address: String,
} */

/* enum IpAddr {
    V4(String),
    V6(String),
} */

/* struct Ipv4Addr {
    // --snip--
}

struct Ipv6Addr {
    // --snip--
}

enum IpAddr {
    V4(Ipv4Addr),
    V6(Ipv6Addr),
}
enum Message {
    Quit,
    Move { x: i32, y: i32 },
    Write(String),
    ChangeColor(i32, i32, i32),
}

struct QuitMessage; // unit struct
struct MoveMessage {
    x: i32,
    y: i32,
}
struct WriteMessage(String); // tuple struct
struct ChangeColorMessage(i32, i32, i32); // tuple struct */
/* #[warn(dead_code)]
enum Coin {
    Penny,
    Nickel,
    Dime,
    Quarter,
}

fn value_in_cents(coin: Coin) -> u8 {
    match coin {
        Coin::Penny => 1,
        Coin::Nickel => 5,
        Coin::Dime => 10,
        Coin::Quarter => 25,
    }
} */

#[derive(Debug)]
enum UsState {
    Alabama,
    Alaska,
    // --snip--
}

enum Coin {
    Penny,
    Nickel,
    Dime,
    Quarter(UsState),
}
fn value_in_cents(coin: Coin) -> u8 {
    match coin {
        Coin::Penny => 1,
        Coin::Nickel => 5,
        Coin::Dime => 10,
        Coin::Quarter(state) => {
            println!("State quarter from {:?}!", state);
            25
        }
    }
}
fn main() {
    //1.0
    /*     let home = IpAddr {
        kind: IpAddressKind::V4,
        address: "127.0.0.1".to_string(),
    };

    let company = IpAddr {
        kind: IpAddressKind::V6,
        address: "localhost".to_string(),
    }; */

    //2.0
    /*     let home = IpAddr::V4("127.0.0.1".to_string());

    let loopback = IpAddr::V6(String::from("::1"));

    println!("{}", "hello,world"); */

    //3.0
    /*     let num = value_in_cents(Coin::Penny);

    println!("{}", num); */

    //4.0
    // value_in_cents(Coin::Quarter(UsState::Alaska));

    //5.0
    /*     let some_number = Some(8);
    let some_string = Some("a string");
    let type_str: Option<&str> = None; */

    let x: i8 = 5;

    let y: Option<i8> = Some(6);

    let d = x + y.unwrap();
}
